package com.johnny.xia.tread;

import com.johnny.xia.util.cache.RedisUtil;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadMain {
    public static void main(String[] args) {

        ExecutorService exePool = Executors.newFixedThreadPool(50);
        String key = "philips_hb"+System.currentTimeMillis();
        RedisUtil ru = new RedisUtil();
//        ru.initNum(key, String.valueOf(1000));
        for (int i = 0; i < 1; i++) {
            exePool.execute(new RedisTask("thread-0" + i, key, 1L));
        }

        exePool.shutdown();
        while (true) {
            if (exePool.isTerminated()) {
                System.out.println("结束了！剩余：" + ru.getNum(key));
                break;
            }
        }
        ru.closeServer();
    }
}
